//
// Created by HeiBai on 2020/6/13.
//

#ifndef NDK_PLAYER_CODE_JNICALLBACK_H
#define NDK_PLAYER_CODE_JNICALLBACK_H

#include <jni.h>

class JNICallback {
public:
    //这后续操作 会跨线程，不能使用env ，env会失效
    JNICallback(JavaVM *javaVm,JNIEnv *jniEnv,jobject instance);
    ~JNICallback();
    //具体回调给上层的函数(成功)
    //thread_mode区分主线程还是异步线程
    void onPrepared(int thread_mode);


    void onErrorAction(int thread_mode, int error_code);

private:
    JavaVM *javaVm=0;
    JNIEnv *jniEnv=0;
    jobject instance;
    jmethodID  jmd_prepared;
    jmethodID  jmd_error;

};


#endif
